package com.zhaopin.gitlab;

import com.zhaopin.utils.FileUtil;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;

/**
 * 寻找差异文件
 */
public class BathRemoveFile {
    public static void main(String[] args) throws IOException {

        String expPath = "/Users/zhaopin/IdeaProjects/easyjar/dir/downloaddic/noneUseDicListRemovePositionList.txt";
        String dicConfPath = "/Users/zhaopin/IdeaProjects/aggregator/rpc_position-recommend/groovy/src/main/groovy/com/zhaopin/script/data/config";
        String dicInitPath = "/Users/zhaopin/IdeaProjects/aggregator/rpc_position-recommend/groovy/src/main/groovy/com/zhaopin/script/data/init";

        List<String> list = FileUtils.readLines(new File(expPath), Charset.defaultCharset());
        int i = 0;
        for (String s : list) {

            File file = new File(dicConfPath + "/" + s + ".tsv");
            boolean delete = file.delete();
            if (delete){
                //继续删除init文件
                File file1 = new File(dicInitPath +"/" +  "G_InitData_" + s + ".groovy");
                boolean delete1 = file1.delete();
                if(delete1){
                    System.out.println("删除 success ：" + s + " : "+  i);
                    i++;
                }else{
                    System.out.println("false init:" + s);
                }
            }else{
                    System.out.println("false tsv:" + s);
            }


        }

        //java删除文件


    }
}
